package com.heiye.kv.biz.controller;

import com.heiye.kv.biz.service.QuizContentService;
import com.heiye.kv.api.dto.req.AddQuizContentReqDTO;
import com.heiye.kv.api.dto.req.DeleteQuizContentReqDTO;
import com.heiye.kv.api.dto.req.FindQuizContentReqDTO;
import com.heiye.framework.common.response.Response;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: heiye
 * @date: 2025/03/13 上午10:29
 * @version: v1.0.0
 * @description: 提问内容存储业务
 */
@Slf4j
@RestController
@RequestMapping("/kv")
public class QuizContentController {

    @Resource
    private QuizContentService quizContentService;

    /**
     * 添加提问内容
     *
     * @param addQuizContentReqDTO
     * @return
     */
    @PostMapping(value = "/quiz/content/add")
    public Response<?> addQuizContent(@Validated @RequestBody AddQuizContentReqDTO addQuizContentReqDTO) {
        return quizContentService.addQuizContent(addQuizContentReqDTO);
    }

    /**
     * 查询提问内容
     *
     * @param findQuizContentReqDTO
     * @return
     */
    @PostMapping(value = "/quiz/content/find")
    public Response<?> findQuizContent(@Validated @RequestBody FindQuizContentReqDTO findQuizContentReqDTO) {
        return quizContentService.findQuizContent(findQuizContentReqDTO);
    }

    /**
     * 删除提问内容
     *
     * @param deleteQuizContentReqDTO
     * @return
     */
    @PostMapping(value = "/quiz/content/delete")
    public Response<?> deleteQuizContent(@Validated @RequestBody DeleteQuizContentReqDTO deleteQuizContentReqDTO) {
        return quizContentService.deleteQuizContent(deleteQuizContentReqDTO);
    }
}
